package com.game.view;

import com.game.model.api.EquipType;
import com.game.model.api.Quality;
import com.game.model.api.RoleType;

/**
 * @Description:翻译为中文,改变字体主题颜色等等...
 **/
public class TranslateToChinese {
    public static String getRoleType(RoleType roleType) {
        switch (roleType) {
            case ARCHER:
                return "弓箭手";
            case ASSASSIN:
                return "刺客";
            case WARRIOR:
                return "战士";
        }
        return "未知";
    }

    public static String getEquipType(EquipType equipType) {
        switch (equipType) {
            case WEAPON:
                return "武器";
            case LEG:
                return "腿部";
            case BODY:
                return "身体";
            case HEAD:
                return "头部";
            case SHOES:
                return "鞋子";
        }
        return "未知";
    }

    public static String getQuality(Quality quality) {
        switch (quality) {
            case WHITE:
                return getFormatLogString("白色", 37, 0, 0);
            case GREEN:
                return getFormatLogString("绿色", 32, 0, 0);
            case BLUE:
                return getFormatLogString("蓝色", 34, 0, 0);
            case PURPLE:
                return  getFormatLogString("紫色", 35, 0, 0);
            case ORGANGE:
                return  getFormatLogString("橙色", 33, 0, 0);
            case RED:
                return  getFormatLogString("红色", 31, 0, 0);
        }
        return "未知";
    }

    /**
     * @param colour  颜色代号：背景颜色代号(41-46)；前景色代号(31-36)
     * @param type    样式代号：0无；1加粗；3斜体；4下划线
     * @param content 要打印的内容
     */
    public static String getFormatLogString(String content, int colour, int background, int type) {
        if(background<=0&&type<=0){
            return String.format("\033[%dm%s\033[0m", colour, content);
        }
        if(background<=0){
            return String.format("\033[%d;%dm%s\033[0m", colour,type, content);
        }
        return String.format("\033[%d;%d;%dm%s\033[0m", colour, background, type, content);
    }
    public static String getRedString(String content){
        return String.format("\033[%dm%s\033[0m", 31, content);
    }
}
